# coding:utf-8
from page.login_page import LoginPage

class LoginHandle:
    def __init__(self, i):
        self.login_page = LoginPage(i)

    # 操作登录页面的元素
    def to_login(self):
        self.login_page.get_tologin_element().click()
    def send_username(self, username):
        self.login_page.get_username_element().clear()
        self.login_page.get_username_element().send_keys(username)
        # 输入用户名
    def send_password(self, password):
        self.login_page.get_password_element().click()
        self.login_page.get_password_element().send_keys(password)
        # 输入密码
    def click_next(self):
        self.login_page.get_next_element().click()
        # 点击下一步
    def click_login(self):
        self.login_page.get_login_element().click()
        # 点击登录
    def phone_login(self):
        self.login_page.get_phone_login_element().click()
        # 点击跳转手机号码登录
    def email_login(self):
        self.login_page.get_email_login_element().click()
        # 点击跳转email码登录
    def forget_password(self):
        self.login_page.get_forgetpassw_element().click()
        # 点击忘记密码
    def back_button(self):
        self.login_page.get_back_element().click()
        # 点击返回
    def get_fail_tost(self, message):
        # 获取tost,根据返回信息进行返数据
        tost_element = self.login_page.get_tost_element(message)
        if tost_element:
            return True
        else:
            False
